<template>
  <div class="device-section">
    <div class="section-header">
      <el-icon><Monitor /></el-icon>
      <h2>自助挂号缴费机</h2>
    </div>
    
    <div class="device-options">
      <div 
        v-for="option in selfServiceOptions" 
        :key="option.id" 
        class="option-card"
        :class="{ disabled: option.disabled }"
        @click="!option.disabled && selectSelfService(option)"
      >
        <div class="option-icon">
          <el-icon><component :is="option.icon" /></el-icon>
        </div>
        <div class="option-title">{{ option.title }}</div>
        <div class="option-desc">{{ option.desc }}</div>
        <div v-if="option.disabled" class="status-tag">暂不可用</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { shallowRef } from 'vue'
import { ElMessage } from 'element-plus'
import { useRouter } from "vue-router";
import { 
  Monitor,
  Ticket,
  Coin,
  Printer,
  Document,
  List
} from '@element-plus/icons-vue'

const router = useRouter();

// 自助挂号缴费机选项
const selfServiceOptions = shallowRef([
  { id: 1, title: '自助挂号', desc: '选择科室与医生进行挂号', icon: Ticket, disabled: false,link:'/self-service/registration-scan'  },
  { id: 2, title: '门诊缴费', desc: '使用医保卡或扫码支付', icon: Coin, disabled: false ,link:'/self-service/payment-start-scan' },
  { id: 3, title: '报告打印', desc: '打印检验检查报告单', icon: Printer, disabled: true },
  { id: 4, title: '信息查询', desc: '查询就诊记录与费用', icon: Document, disabled: true },
  { id: 5, title: '医保服务', desc: '医保相关业务办理', icon: List, disabled: true },
  { id: 6, title: '病历打印', desc: '打印门诊病历与处方', icon: Printer, disabled: true }
])

// 选择自助服务
const selectSelfService = (option) => {
  ElMessage.info(`您选择了: ${option.title}`)
  // 跳转到科室选择页面作为示例
  router.push(option.link)
  // 实际应用中这里会跳转到相应页面或打开对应功能
}
</script>

<style lang="scss" scoped>
.device-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ebeef5;
  
  h2 {
    margin: 0 0 0 10px;
    font-size: 18px;
    color: #303133;
  }
  
  .el-icon {
    font-size: 24px;
    color: #1a75bc;
  }
}

// 自助服务选项样式
.device-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  flex: 1;
}

.option-card {
  border: 1px solid #ebeef5;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  
  &:hover:not(.disabled) {
    border-color: #1a75bc;
    box-shadow: 0 2px 12px 0 rgba(26, 117, 188, 0.2);
    transform: translateY(-2px);
  }
  
  &.disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }
}

.option-icon {
  font-size: 32px;
  color: #1a75bc;
  margin-bottom: 10px;
}

.option-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #303133;
}

.option-desc {
  font-size: 12px;
  color: #909399;
}

.status-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f56c6c;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 10px;
}

// 响应式设计
@media (max-width: 768px) {
  .device-options {
    grid-template-columns: 1fr;
  }
}
</style>